package com.example.springbootrbac.controller;

import com.example.springbootrbac.pojo.Result;
import com.example.springbootrbac.pojo.ResultCode;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@RestController
public class FilterController {
    @PostMapping("/jumpFilter") //跳转器
    public  Result<Integer> jumpFilter(HttpServletRequest request){
        HttpSession session = request.getSession();
        if (!ObjectUtils.isEmpty(session.getAttribute("user"))){
            return Result.success(ResultCode.SUCCESS_JUMP);
        }
        return Result.failure(ResultCode.FAILURE_FILTER_NOT_LOGIN_ERROR);
    }

}
